package com.enjoy.prepare.proxy.jdkdynamic;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * 类说明：执行类-动态代理
 */
public class JamesInvocationHandler implements InvocationHandler {

    private Object receptionist;

    public JamesInvocationHandler(Object receptionist) {
        this.receptionist = receptionist;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("James find receptionist....");
        Object result = method.invoke(receptionist, args);
        System.out.println("half price...");
        return result;
    }


}
